[Repo Assist] feat(stdlib): add collections module bindings (Counter, defaultdict, deque, OrderedDict)#272
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
…deque, OrderedDict) Adds F# bindings for the most commonly used classes in Python's collections module: - Counter<'T>: count hashable objects; supports most_common, elements, total, update, subtract; static Counter.ofSeq factory - defaultdict<'TKey, 'TValue>: dict with callable factory for missing keys; includes contains helper to check key presence without invoking factory - deque<'T>: O(1) double-ended queue with append/appendleft, pop/popleft, rotate, and optional bounded maxlen; static ofSeq and withMaxlen factories - OrderedDict<'TKey, 'TValue>: dict subclass with move_to_end and order-sensitive popitem Also adds 35 tests covering construction, mutation, and edge cases for all four types. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated pull request from Repo Assist, an AI assistant for this repository.
Summary
Adds F# bindings for the four most widely used classes from Python's [
collections]((docs.python.org/redacted) module.Counter<'T>.most_common(),.elements(),.total(),.update(),.subtract()defaultdict<'TKey, 'TValue>.contains()checks without triggering factorydeque<'T>.append/.appendleft,.pop/.popleft,.rotate, boundedmaxlenOrderedDict<'TKey, 'TValue>.move_to_end()and order-sensitive.popitem()Usage examples
Files changed
src/stdlib/Collections.fs— new bindings filetest/TestCollections.fs— 35 tests covering all four typessrc/Fable.Python.fsproj— include new source filetest/Fable.Python.Test.fsproj— include new test fileDesign notes
[<Import("ClassName", "collections")>]pattern, consistent withQueue,datetime, etc.Counter.ofSeq,deque.ofSeq,deque.withMaxlen) handle constructor variants rather than adding extra primary constructor overloads, which follows the pattern established inDatetime.fs.defaultdict.getandOrderedDict.getdo not invoke the factory — behaviour matches Python exactly.CHANGELOG.mdis intentionally not updated per repository policy.CI will validate the build and Python tests.
Note
🔒 Integrity filter blocked 10 items
The following items were blocked because they don't meet the GitHub integrity level.
list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: